package com.yuyue.dronesystem.beans;

import java.util.Objects;

import com.yuyue.dronesystem.enums.BoxType;

/**
 * Box
 */
public class Box {

    // 长（英寸）
    private Double length = 0.0;
    // 宽（英寸）
    private Double width = 0.0;
    // 高（英寸）
    private Double height = 0.0;
    // 容器类型
    private BoxType type = BoxType.OTHER;

    public Box() {
    }
    
    public Box(Box box) {
        this.length = box.getLength();
        this.width = box.getWidth();
        this.height = box.getLength();
        this.type = box.getType();
    }

    public Box(Double length, Double width, Double height) {
        this.length = length;
        this.width = width;
        this.height = height;
    }

    public Box(Double length, Double width, Double height, BoxType type) {
        this(length, width, height);
        this.type = type;
    }

    public Double getLength() {
        return this.length;
    }

    public void setLength(Double length) {
        this.length = length;
    }

    public Double getWidth() {
        return this.width;
    }

    public void setWidth(Double width) {
        this.width = width;
    }

    public Double getHeight() {
        return this.height;
    }

    public void setHeight(Double height) {
        this.height = height;
    }

    public BoxType getType() {
        return this.type;
    }

    public void setType(BoxType type) {
        this.type = type;
    }

    public Box length(Double length) {
        this.length = length;
        return this;
    }

    public Box width(Double width) {
        this.width = width;
        return this;
    }

    public Box height(Double height) {
        this.height = height;
        return this;
    }

    public Box type(BoxType type) {
        this.type = type;
        return this;
    }

    @Override
    public boolean equals(Object o) {
        if (o == this)
            return true;
        if (!(o instanceof Box)) {
            return false;
        }
        Box box = (Box) o;
        return Objects.equals(length, box.length) && Objects.equals(width, box.width) && Objects.equals(height, box.height) && Objects.equals(type, box.type);
    }

    @Override
    public int hashCode() {
        return Objects.hash(length, width, height, type);
    }

    @Override
    public String toString() {
        return "{" +
            " length='" + getLength() + "'" +
            ", width='" + getWidth() + "'" +
            ", height='" + getHeight() + "'" +
            ", type='" + getType() + "'" +
            "}";
    }
}